package dev.bong.mapper;


import dev.bong.annotation.AutoFill;
import dev.bong.enumeration.OperationType;
import dev.bong.pojo.entity.Semester;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface SemesterMapper {


    List<Semester> getSemesterList();

    @AutoFill(OperationType.INSERT)
    void addSemester(Semester semester);

    @Update("update semester set semester_status = 1 where id = #{id}")
    void setCurrentSemester(int id);
    @Update("update semester set semester_status = 0 where semester_status = 1")
    void delPreSemester();

    @Select("select semester from semester where semester_status = 1")
    String getCurrentSemester();
}
